package com.youkeda.dewu.api;

import com.youkeda.dewu.model.Result;
import com.youkeda.dewu.param.PaymentParam;
import com.youkeda.dewu.param.PaymentRecordQueryParam;
import com.youkeda.dewu.service.PayService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author 刘正星
 * @version 1.0.0
 * @ClassName PaymentApi.java
 * @Description TODO
 * @createTime 2020年10月13日 15:24:00
 */
@RestController
@RequestMapping("/api/alipay")
public class PaymentApi {
    @Autowired
    private PayService payService;

    @GetMapping("/pay")
    public Result payOrder(@RequestBody PaymentParam paymentParam){
        Result result = new Result();
        result.setSuccess(true);
        if (paymentParam == null){
            result.setMessage("failed");
            result.setSuccess(false);
            return result;
        }
        result = payService.payOrder(paymentParam);
        result.setMessage("successful");
        return result;

    }

}
